<!--{eval $_TPL['titles'] = array('好友');}-->
<!--{template header}-->

<div class="c_header a_header">
	<a href="space.php?uid=$space[uid]"><img src="<!--{avatar($space[uid],small)}-->" alt="$space[username]" class="avatar" /></a>
	<h1>好友</h1>
	<a href="space.php?uid=$space[uid]" class="spacelink"><!--{if $space[self]}-->我<!--{else}-->$space[username]<!--{/if}-->的空间</a>
</div>

<!--{if $space[self]}-->
<div class="tabs_header">
	<ul class="tabs">
		<li$actives[me]><a href="space.php?uid=$space[uid]&do=friend">好友列表</a></li>
		<li$actives[visitor]><a href="space.php?uid=$space[uid]&do=friend&view=visitor">我的访客</a></li>
		<li$actives[trace]><a href="space.php?uid=$space[uid]&do=friend&view=trace">我的足迹</a></li>
		<li$actives[ol]><a href="space.php?uid=$space[uid]&do=friend&view=online">在线用户</a></li>
		<li><a href="cp.php?ac=friend&op=find">寻找好友</a></li>
		<!--{if empty($_SCONFIG['closeinvite'])}-->
		<li><a href="cp.php?ac=invite">邀请好友</a></li>
		<!--{/if}-->
	</ul>
</div>
<!--{/if}-->

<div class="h_status">
	<!--{if $_GET['view']}-->
	每页显示 $perpage 个用户
	<!--{else}-->
	<!--{if $space[friendnum]}-->
		<!--{if $space[self]}-->
		<table width="100%">
			<tr>
				<td>
					<select name="friend_group" onchange="location.href='space.php?do=friend&group='+this.value">
						<option value="-1">全部好友($space[friendnum])</option>
						<!--{loop $groups $key $value}-->
						<option value="$key"$groupselect[$key]>$value</option>
						<!--{/loop}-->
	                </select>
					<span class="pipe">|</span><a href="cp.php?ac=friend&op=groupname">设置好友分组名</a><span class="pipe">|</span><a href="cp.php?ac=friend&op=group">好友批量分组</a>
				</td>
				<td width="187">
					<script type="text/javascript" src="source/script_autocomplete.js"></script>
					<table cellspacing="0" cellpadding="0">
						<tr>
							<td style="padding: 0;"><input type="text" id="username" name="username" value="搜索好友" onfocus="if(this.value=='搜索好友')this.value='';" class="t_input" tabindex="1" onclick="auc.handleEvent(this.value ,event);" onkeyup="auc.handleEvent(this.value ,event);inputKeyDown(event, 1);" onkeydown="closeOpt(event);inputKeyDown(event);" autocomplete="off" style="width: 160px; border-right: none;" /></td>
							<td style="padding: 0;"><a href="javascript:searchFriend();"><img src="image/search_btn.gif" alt="搜索" /></a></td>
						</tr>
					</table>
	                
					<div id="username_menu" class="ajax_selector" onclick="$('username_menu').style.display='none';" style="display:none">
						<div class="ajax_selector_option" style="width: 181px; height: 100px;">
							<a href="javascript:;" onclick="$('username_menu').style.display='none';" class="float_del" style="margin-right: 5px;">a</a>
							<ul id="friendlist" class="blocklink"></ul>
						</div>
					</div>
					<script type="text/javascript">
						var close = true;
						var auc = new sAutoComplete("auc", "username_menu", "friendlist", "username", 0, searchFriend);
						auc.addItem('$friendstr');
						function closeOpt(evt) {
							if(evt.keyCode==9) {
								$('username_menu').style.display='none';
							}
						}
						function inputKeyDown(event, search) {
							if(isUndefined(search)) search = 0;
							if(event.keyCode == 13){
								if(search) searchFriend();
								doane(event);
							}
						}
						function searchFriend() {
							var username = $('username').value;
							if(username == '搜索好友' || username == '') {
								alert('请输入好友名称');
							} else {
								location.href ='space.php?do=friend&key='+username;
							}
						}
					</script>
				</td>
			</tr>
		</table>
		<!--{else}-->
		$space[friendnum] 个好友
		<!--{/if}-->
	<!--{/if}-->
	<!--{/if}-->
</div>

<!--{if $list}-->
<div class="d_content">
	<ul class="user_list" id="friend_ul">
	<!--{loop $list $key $value}-->
		<li id="friend_$value[uid]_li" <!--{if $ols[$value[uid]]}-->class="online"<!--{/if}-->>
			<a href="space.php?uid=$value[uid]" class="avatarlink"><img src="<!--{avatar($value[uid],middle)}-->" alt="$value[username]" class="avatar" /></a>
			<table cellspacing="0" cellpadding="0" class="infotable" style="table-layout: fixed;">
				<caption>
				<a href="space.php?uid=$value[uid]">$value[username]</a>
				</caption>
				<!--{if $_GET['view'] == 'visitor' || $_GET['view'] == 'trace'}-->
				<tr>
					<th width="40">到访：</th>
					<td><!--{date('m-d H:i',$value[dateline],1)}--></td>
				</tr>
				<!--{/if}-->
				<!--{if $ols[$value[uid]]}-->
				<tr>
					<th width="40">动作：</th>
					<td><!--{date('m-d H:i',$ols[$value[uid]],1)}--></td>
				</tr>
				<!--{/if}-->
				<!--{if $space['self'] && empty($_GET['view'])}-->
				<tr>
					<th width="40">分组：</th>
					<td><a href="cp.php?ac=friend&op=changegroup&uid=$value[uid]" id="a_group_$key" onclick="ajaxmenu(event, this.id, 99999)"><span id="friend_group_$value[uid]">$value[group]</span></a></td>
				</tr>
				<!--{/if}-->
				<!--{if $value[resideprovince] || $value[residecity]}-->
				<tr>
					<th width="40">地区：</th>
					<td><a href="network.php?ac=space&resideprovince=$value[p]&residecity=&searchmode=1">$value[resideprovince]</a> <a href="network.php?ac=space&resideprovince=$value[p]&residecity=$value[c]&searchmode=1">$value[residecity]</a></td>
				</tr>
				<!--{/if}-->
				<!--{if $value[note]}-->
				<tr>
					<th width="40">状态：</th>
					<td>$value[note]</td>
				</tr>
				<!--{/if}-->
			</table>
			<ul class="blocklink">
				<li><a href="space.php?uid=$value[uid]">查看空间</a></li>
				<!--{if $space['self'] && empty($_GET['view'])}-->
				<li><a href="space.php?uid=$value[uid]&do=friend">查看好友列表</a></li>
				<!--{else}-->
				<li><a href="cp.php?ac=friend&op=add&uid=$value[uid]" id="a_friend_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)">加为好友</a></li>
				<!--{/if}-->
				<li><a href="cp.php?ac=pm&uid=$value[uid]" id="a_pm_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)">发短消息</a></li>
				<li><a href="cp.php?ac=poke&op=send&uid=$value[uid]" id="a_poke_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)">打招呼</a></li>
			</ul>
		</li>
	<!--{/loop}-->
	</ul>

	<div class="page">$multi[html]</div>
</div>

<!--{else}-->
<div class="article c_form">
	还没有相关好友。
	<!--{if $space[self] && !isset($_GET['group']) && empty($_GET['view'])}-->
		<a href="cp.php?ac=friend&op=find">把你的好友加入进来</a>，你可以非常方便的跟踪好友动态。
	<!--{/if}-->
</div>
<!--{/if}-->

<div class="f_status f_status_w s_clear">
	<a href="javascript:;" onclick="window.scrollTo(0,0);" id="a_top" title="TOP">TOP</a>
</div>
<!--{template footer}-->